home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD School House 10
/
CD School House - Education and Games (10.0) - Wayzata Technology (1995).iso
/
mac
/
DOS
/
MATH
/
ODE25
/
ORBIT.ODE
< prev
next >
Wrap
Text File
|
1994-03-03
|
378b
|
22 lines
# ORBIT.ODE
# A planetary orbit around a fixed star. It should be an ellipse.
# Use 4th order Runge-Kutta, fixed step size, 200 steps, solve to t=50.
$m -4
$n 200
$t 50
# Planet is at (x,y)
x = 1
y = 0
# Initial velocity
vx = 0
vy = 1
# Dynamics given by Newton's second law:
r3 = cub(sqrt(sqr(x)+sqr(y)))
x' = vx
y' = vy
vx' = -x/r3
vy' = -y/r3